<?php

use App\Enums\FinancialAudit;
use App\Enums\SalePerformanceSaleType;
use App\Enums\SalePerformanceType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSalePerformancesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sale_performances', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('payment_option_id')->default(0)->index()->comment('付款方式');
            $table->unsignedBigInteger('customer_id')->index()->default(0)->comment('客户id');
            $table->unsignedBigInteger('user_id')->index()->default(0)->comment('销售id');
            $table->unsignedTinyInteger('type')->default(SalePerformanceType::DEPOSIT)->comment('类型:0=定金,1=尾款,2=全款');
            $table->decimal('money', 20)->default(0.00)->comment('金额');
            $table->text('pay_images')->comment('付款截图');
            $table->string('medication')->default('')->comment('用药天数');
            $table->string('treatment')->default('')->comment('治疗周期');
            $table->string('bill')->default('')->comment('票据要求');
            $table->string('disease')->default('')->comment('病种');
            $table->text('symptom')->nullable()->comment('症状');
            $table->timestamp('consultation')->nullable()->comment('看诊时间');
            $table->text('remark')->nullable()->comment('备注');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sale_performances');
    }
}
